<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:c="http://java.sun.com/jsp/jstl/core"
                template="./../templates/StakeholderPortalTemplate.xhtml">
    <ui:define name="content">
        <h1>Stakeholder Add Table Type</h1>
        <h:form>
            <p:panel id="panel" header="Add a table type">
                <p:ajaxStatus style="width:16px;height:16px;">
                    <f:facet name="start">
                        <h:graphicImage value="http://www.primefaces.org:8080/showcase/design/ajaxloading.gif" />
                    </f:facet>
                    <f:facet name="complete">
                        <h:outputText value="" />
                    </f:facet>
                </p:ajaxStatus>
                <p:messages />
                <h:panelGrid columns="3" columnClasses="column" cellpadding="5">

                    <h:outputText value="Table type name: " />
                    <p:inputText required="true" requiredMessage="Table type name is required." id="tabletypename" value="#{tableManagerBean.tableType.name}">
                        <p:ajax event="blur" update="tabletypenameMsg" />
                    </p:inputText>
                    <p:message id="tabletypenameMsg" for="tabletypename" />

                    <h:outputText value="Unit capacity: " />
                    <h:selectOneMenu value="#{tableManagerBean.tableType.unitCapacity}" id="unitcapacitylist">
                        <f:selectItem itemLabel="1 person" itemValue="1"></f:selectItem>
                        <f:selectItem itemLabel="2 persons" itemValue="2"></f:selectItem>
                        <f:selectItem itemLabel="3 persons" itemValue="3"></f:selectItem>
                        <f:selectItem itemLabel="4 persons" itemValue="4"></f:selectItem>
                        <f:selectItem itemLabel="5 persons" itemValue="5"></f:selectItem>
                        <f:selectItem itemLabel="6 persons" itemValue="6"></f:selectItem>
                        <f:selectItem itemLabel="7 persons" itemValue="7"></f:selectItem>
                        <f:selectItem itemLabel="8 persons" itemValue="8"></f:selectItem>
                        <f:selectItem itemLabel="9 persons" itemValue="9"></f:selectItem>
                        <f:selectItem itemLabel="10 persons" itemValue="10"></f:selectItem>
                        <f:selectItem itemLabel="11 persons" itemValue="11"></f:selectItem>
                        <f:selectItem itemLabel="12 persons" itemValue="12"></f:selectItem>
                        <f:selectItem itemLabel="13 persons" itemValue="13"></f:selectItem>
                        <f:selectItem itemLabel="14 persons" itemValue="14"></f:selectItem>
                        <f:selectItem itemLabel="15 persons" itemValue="15"></f:selectItem>
                        <f:selectItem itemLabel="16 persons" itemValue="16"></f:selectItem>
                        <f:selectItem itemLabel="17 persons" itemValue="17"></f:selectItem>
                        <f:selectItem itemLabel="18 persons" itemValue="18"></f:selectItem>
                        <f:selectItem itemLabel="19 persons" itemValue="19"></f:selectItem>
                        <f:selectItem itemLabel="20 persons" itemValue="20"></f:selectItem>
                    </h:selectOneMenu>
                    <p:message id="unitcapacitylistMsg" for="unitcapacitylist" />

                    <h:outputText value="Description: " />
                    <p:inputTextarea required="true" requiredMessage="Description for the table type is required" style="width:300px;height:100px;" effectDuration="400" id="description" value="#{tableManagerBean.tableType.description}">
                        <p:ajax event="blur" update="descriptionMsg" />
                    </p:inputTextarea>
                    <p:message id="descriptionMsg" for="description" />

                    <h:outputText value="Image URL: " />                     
                    <p:fileUpload id="imageURL" fileUploadListener="#{tableManagerBean.handleTableImageUpload}" 
                                  allowTypes="*.jpg;*.png;*.gif;" description="Images" sizeLimit="524288"/>
                    <p:message id="imageURLMsg" for="imageURL"/> 
                </h:panelGrid>
                <p:commandButton id="submitbutton" value="Submit" update="panel" actionListener="#{tableManagerBean.addTableType}" ajax="true" />
            </p:panel>
        </h:form>
    </ui:define>
</ui:composition>

